<?php
namespace bb;

class Sms {
	
	public static $username='tingzan88';	//发送短信账户
	public static $password='tingzan123';	//发送短信密码
	public static $url='http://www.ztsms.cn/sendSms.do';	//可连续发送短信地址
	public function __construct(){
		header("Content-type: text/html; charset=utf-8");
	}
	//==============
	public function endsms($mobile,$content){
			
		file_put_contents('res.txt','收到请求:'.date('Y-m-d H:i:s').PHP_EOL.'通知信息:'.$mobile.$content.PHP_EOL.PHP_EOL.PHP_EOL,FILE_APPEND);
				
		$array=array(
			'username'=>self::$username,
			'password'=>self::$password,
			'mobile'=>$mobile,
			'content'=>$content."【挺赞洗衣】",
			'dstime'=>'',
			'productid'=>'676767',
			'xh'=>''
		);
		$snoopy = new \bb\Snoopy();
		$snoopy->submit(self::$url,$array);		//发送短信接口
		$res=$snoopy->results; 						//获取短信接口返回值
		
		file_put_contents('res.txt','收到请求:'.date('Y-m-d H:i:s').PHP_EOL.'通知信息:'.$res.PHP_EOL.PHP_EOL.PHP_EOL,FILE_APPEND);
		
		$re=strpos($res,",");
		if($re){
			if(substr($res,0,1)=='1'){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	
}